package pack0916;

import java.util.Scanner;

    // 练习1：从键盘输入一个四位正整数，求其各位数字之和。
    public class DemoD {
        public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            int number = scan.nextInt();
            int sum = 0;
            if (number > 9999 || number < 1000) {
                System.out.println("请输入一个四位整数！");
                return;
            }
            do {
                int gewei = number % 10;
                number = number / 10;
                sum += gewei; // sum = sum + gewei;
            } while (number > 0);
            System.out.println(sum);
        }
    }
